#ifndef TOKEN_H
#define TOKEN_H

#include "location.h"

typedef enum tokentype{
    TK_NONE,
    TK_END,
    TK_IDENTIFY,
    TK_NUMBER,
    TK_FLOAT,
    TK_STRING,
    TK_COMMENT,
    //normal
    TKOPT_INC, //++
    TKOPT_DEC, //--
    TKOPT_ADD, // +
    TKOPT_SUB, // -
    TKOPT_MUL, // *
    TKOPT_DIV, // /
    TKOPT_MOD, // %
    TKOPT_ASSIGN, // =
    TKOPT_ADDASSIGN, // +=
    TKOPT_SUBASSIGN, // -=
    TKOPT_MULASSIGN, // *=
    TKOPT_DIVASSIGN, // /=
    TKOPT_MODASSIGN, // %=
    //bit
    TKOPT_BITAND, // &
    TKOPT_BITOR, // |
    TKOPT_BITXOR, // ^
    TKOPT_BITNOT, // ~
    TKOPT_BITANDASSIGN ,// &=
    TKOPT_BITORASSIGN ,// |=
    TKOPT_BITXORASSIGN, // ^=
	//bit shift
	TKOPT_SHIFTLEFT,
	TKOPT_SHIFTRIGHT,
	TKOPT_SHIFTLEFTASSIGN,
	TKOPT_SHIFTRIGHTASSIGN,
    //bool
    TKOPT_AND, // &&
    TKOPT_OR, // ||
    TKOPT_NOT, // !
    TKOPT_ANDASSIGN, // &&=
    TKOPT_ORASSIGN, // ||=
    //area
    TKOPT_LEFTBRACKET, // (
    TKOPT_RIGHTBRACKET, // )
    TKOPT_LEFTBLOCK, // {
    TKOPT_RIGHTBLOCK, // }
    TKOPT_LEFTINDEX, // [
    TKOPT_RIGHTINDEX, // ]
    //cmp
    TKOPT_MORE, // >
    TKOPT_MORETHAN, // >=
    TKOPT_LESS, // <
    TKOPT_LESSTHAN, // <=
    TKOPT_EQUAL, // ==
    TKOPT_NOTEQUAL, // !=
    //special
    TKOPT_TO, // =>
    TKOPT_AS, // :
    //grammar
    TKOPT_END, // ;
    TKOPT_COMMA, // ,
    TKOPT_DOT, // .
    //keyword
    TKKEY_DO, //do
    TKKEY_IF, //if
    TKKEY_ELSE, //else
    TKKEY_WHILE, //while
    TKKEY_FOR, //for
    TKKEY_RETURN, //return
    TKKEY_BREAK, //break
    TKKEY_CONTINUE, //continue
    TKKEY_TRUE, //true
    TKKEY_FALSE, //false
    TKKEY_NAMESPACE, //namespace
    TKKEY_IMPORT, //import
    TKKEY_STRUCT, //struct
    TKKEY_ENUM, //enum
    TKKEY_INTERFACE, //interface
    TKKEY_NEW, //new
    TKKEY_DELETE, //delete
    TKKEY_NULL, //null    
    TKKEY_VOID, //void
    TKKEY_BOOL, //bool
    TKKEY_CHAR, //char
    TKKEY_UCHAR, //uchar
    TKKEY_SHORT,
    TKKEY_USHORT,
    TKKEY_INT, //int
    TKKEY_UINT, //uint
    TKKEY_LONG, //long
    TKKEY_ULONG, //ulong
    TKKEY_FLOAT, //float
    TKKEY_DOUBLE, //doubule
    //TKKEY_STRING, //string
}TokenType;

typedef struct _token{
    TokenType type;
    char *text;
    SourceLocation location;
}Token;

Token *createToken();
Token *createLabelToken(SourceLocation *location);
void freeToken(Token *token);
Token *initToken(Token *token,TokenType type,SourceLocation *location,char *text);
Token *checkKeyToken(Token *token);
Token *handleStringToken(Token *token);
void printToken(Token *token);

#endif // TOKEN_H
